﻿using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Reflection;

namespace RenameSubtitles
{
    class LogFile:IDisposable
    {
        private StreamWriter sr;
        public LogFile()
        {
            string path=Assembly.GetExecutingAssembly().Location;
            FileInfo fi = new FileInfo(path);
            sr = new StreamWriter(fi.DirectoryName+ "\\RenameSubtitles.log" , false);
        }
        public LogFile(string fileName)
        {
            sr= new StreamWriter(fileName, false);
        }
        public void WriteLine(string text)
        {
            //Console.WriteLine(text);
            sr.WriteLine(text);
        }
        public void WriteLine(string format, params object[] arg)
        {
            //Console.WriteLine(format, arg);
            sr.WriteLine(format, arg);
        }

        #region IDisposable Members

        public void Dispose()
        {
            sr.Close();
        }

        #endregion
    }
}
